global_var = 42

local_var = 10




code= """

global_var = 42

local_var = 111

"""


code = code + """

result = global_var + local_var

"""


namespace = {"haha": None}

exec(code, namespace)



result = namespace["result"]

print(result)  # 输出 52

